import os
from sqlmodel import create_engine, SQLModel, Session

DBNAME = os.environ.get("DBNAME", "test")
DBPASSWORD = os.environ.get("DBPASSWORD", "123")
DBHOST = os.environ.get("DBHOST", "172.16.18.131")
DBUSER = os.environ.get("DBUSER", "dev")


MYSQLURL = f"mysql+pymysql://{DBUSER}:{DBPASSWORD}@{DBHOST}/{DBNAME}"


engine = create_engine(MYSQLURL, echo=True)

session = Session(engine)
def create_sql_model():
    from app.sqlModels.test_db import TestModel

    SQLModel.metadata.create_all(bind=engine)


